/**
 * Created by jiangtao on 16/5/6.
 */
$(function(){

    var me = {
        dom:$('body')
    };
    me.init = function(){
        this.selectItemLx();
        this.showMenu();
    }
    me.selectItemLx = function(){
        this.dom.on('click','*[data-name="item-lx"] .list',function(){
            var self = this;
            $('*[data-name="item-lx"] .list').each(function(index,dom){
                  if(dom == self) {
                      $(dom).addClass('active');
                  } else {
                      $(dom).removeClass('active');
                  };
            });
        });
    }
    me.showMenu = function(){
       this.dom.on('click','.menu-list .title-e',function(){
           var self = this;
           var menuUl = $(self).parents('.menu-list').find('ul');
           if($(this).attr('close')){
               $(this).removeAttr('close');
               menuUl.removeClass('hide');
           } else {
               $(this).attr('close','true');
               menuUl.addClass('hide');

           };
       });
    };
    me.init();
});